<html>
<head>
    <link rel="stylesheet" href="../css/style.css">
    <title>学生成绩管理系统</title>
    <script src="../js/jquery-3.7.1.min.js"></script>
    <script>
        $(function() {
            let id = window.location.search.substring(1).split("=")[1];
            console.log(id);
            $.get("http://localhost/dataServer/selectResult.php?id=" + id, function(rs) {
                console.log(rs);
                let data=JSON.parse(rs);
                document.getElementsByName("username")[0].value=data['name'];
                document.getElementsByName("age")[0].value=data['age'];
                document.getElementsByName("result")[0].value=data['result'];
                document.getElementsByName("id")[0].value=data['id'];
            });
        });
    </script>
</head>

<body>
    <h1>修改学生成绩</h1>
    <form action="./dataServer/updateResult.php" method="post">
        <table border="1">
            <tr>
                <td>姓&nbsp;&nbsp;&nbsp;&nbsp;名</td>
                <td><input type="text" id="username" name="username" maxlength="16"></td>
            </tr>
            <tr>
                <td>年&nbsp;&nbsp;&nbsp;&nbsp;龄</td>
                <td><input type="text" id="age" name="age" maxlength="2"></td>
            </tr>
            <tr>
                <td>成&nbsp;&nbsp;&nbsp;&nbsp;绩</td>
                <td><input type="text" id="result" name="result" maxlength="3"></td>
            </tr>
            <tr>
                <td colspan="2">
                    <button type="submit">提交</button> 
                    <input type="hidden"name="id">
                </td>
            </tr>
        </table>
    </form>
</body>

</html>